<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1_props的基本使用</title>
</head>

<body>
    <div id="app"></div>
    <div id="app1"></div>
</body>
<script src="../js/react.development.js"></script>
<script src="../js/react-dom.development.js"></script>
<script src="../js/babel.min.js"></script>

<script type="text/babel">
    class MyComponent extends React.Component{
        render(){
            // React.Component 组件中内置的属性props，用来接受组件上传递过来的值
            const {name,age} = this.props
            return (
                <ul>
                    <li>姓名：{name}</li>
                    <li>年龄：{age}</li>    
                </ul>
            )
        }
    }
    // 组件上传递的属性和属性值会作为key，value放在组件示例的props属性中
    ReactDOM.render(<MyComponent name='李四' age='18'/>,document.getElementById("app"))
    ReactDOM.render(<MyComponent name='王五' age='21'/>,document.getElementById("app1"))
</script>

</html>